﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using SyncedFileAccess;

namespace Test_SyncedFileAccess
{
    class Program
    {
        static void Main(string[] args)
        {
            bool running = true;
            SyncedFile s = new SyncedFile("tst.txt");

            Thread t1 = new Thread(delegate() 
                { 
                    while(running)
                    {
                        s.WriteLine("Test " + running); 
                    }
                });


            Thread t2 = new Thread(delegate()
            {
                while (running)
                {
                    Console.WriteLine(s.ReadNewLine());
                }
            });

            t1.Start();
            //t2.Start();

            Thread.Sleep(200);

            Console.WriteLine(s.ReadFile());
            
            running = false;

        }
    }
}
